layui.use(['form','jquery','layer'],function(){

    var form = layui.form
        ,$ = layui.jquery
        ,layer = layui.layer;

    /*获取当前时间*/
    var newTime;
    getTime();
    function getTime(){
        var myDate = new Date();
        var myYear = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
        var myMonth = myDate.getMonth()+1; //获取当前月份(0-11,0代表1月)
        var myToday = myDate.getDate(); //获取当前日(1-31)
        var myDay = myDate.getDay(); //获取当前星期X(0-6,0代表星期天)
        var myHour = myDate.getHours(); //获取当前小时数(0-23)
        var myMinute = myDate.getMinutes(); //获取当前分钟数(0-59)
        var mySecond = myDate.getSeconds(); //获取当前秒数(0-59)
        newTime = myYear+'-'+myMonth+'-'+myToday+' '+myHour+':'+myMinute+':'+mySecond;
        //console.log(nowTime);
    };

    $('#sub').click(function () {
        $.ajax({
           url:'/login/verificationcode',
           data:{"code":$('#verification').val()},
           success:function (data) {
               if(data.data){
                   var account = $('#account').val();
                   $.ajax({
                        url: '/login/judgeEnabled'
                       ,data:{'account': account}
                       ,dataType: 'json'
                       ,success:function(data){
                            if(data.data.enabled == 2){
                                layer.msg("账号已经封禁");
                            }else if(data.data.enabled == 1){
                                $('#signin').click();
                            }else{

                            }
                       }
                   });
               }else{
                   layer.msg("验证码错误");
                   $('#imgVerify').click();
                   $('#verification').val("");
               }
           }
        });
    });


   //点击登录


    /*登录须知提示信息*/
    $(document).on('mouseenter','#help',function () {
        layer_tips = layer.tips(' &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;登录须知 &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;' +
            '·关于账户： &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; ' +
            '1.账户的所有权归进思科技所有，不可非 &emsp; &emsp; &emsp; 法交易&emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; ' +
            '2.所有账户都由进思科技创建。并分发使 &emsp; &emsp; &emsp; 用&emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; ' +
            '·关于密码： &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; ' +
            '1.账户的所有密码都为原始默人密码&emsp; &emsp; ' +
            '2.在登入系统之后可以自行修改登录密 &emsp; &emsp; &emsp; 码&emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp;&emsp;&emsp; ' +
            '&nbsp; &nbsp;·注意： &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; &emsp; ' +
            '&nbsp; &nbsp; &nbsp; 如果在输入登录账号和密码后页面无响应,请在' +
            '网络环境良好的状态下刚新页面并重新登录。'
            , '#help', {
                time: 0
                ,tips: 2
            });
    }).on('mouseleave', '#help', function () {
        layer.close( layer_tips);
    });



});